from picamera import PiCamera
import time

def takePicture(filename):
    print("start capture...")
    camera = PiCamera()
    camera.rotation= 180
    camera.start_preview()
    time.sleep(5)
    camera.capture(filename)
    print("capture successfully, filename is " + filename)
    camera.stop_preview()

takePicture('QRCODE.png')
#datetime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
#takePicture('img[' + datetime + '].jpg')
